// [[ OnflowGenerator Entity UUID: 9f348f54ef7440cc90e92d5fd4302e86 ]]
package com.itdct.onflow.system.file.entity

import com.baomidou.mybatisplus.annotation.TableName
import com.itdct.onflow.core.annotation.Column
import com.itdct.onflow.core.annotation.ColumnRelateDict
import com.itdct.onflow.core.annotation.TableDescription
import com.itdct.onflow.core.entity.BaseUserEntity
import java.util.*

/**
 * @author Zhouwx
 * @date 2025/9/23 15:34:40
 * @version 1.0
 * @description
 */
@TableDescription("系统文件管理")
@TableName("sys_file_manager")
class SysFileEntity : BaseUserEntity() {
    @Column(comment = "文件名", nullable = false, length = 300, sort = 10, forSelect = true)
    var fileName = ""

    @Column(comment = "原文件名", nullable = false, length = 300, sort = 20)
    var originFileName = ""

    @Column(comment = "文件存储路径", nullable = false, length = 500, sort = 30)
    var storePath = ""

    /**
     * 使用哪种容器进行存储的，比如阿里的OSS，Minio，Nginx服务器，甚至是SpringBoot本地存储
     */
    @Column(comment = "容器类型", nullable = false, length = 64, defaultValue = "local", sort = 40)
    var containerType = ""

    /**
     * 来源于哪个模块
     */
    @ColumnRelateDict(dictCode = "sysModuleName")
    @Column(comment = "所属模块", nullable = false, length = 100, defaultValue = "", indexed = true, sort = 50)
    var moduleName = ""

    @ColumnRelateDict(dictCode = "platformType")
    @Column(comment = "平台类型", nullable = false, length = 100, defaultValue = "onflow-backend", indexed = true, sort = 60)
    var platformType = ""

    @Column(comment = "md5值", defaultValue = "", length = 64, indexed = true, sort = 70)
    var md5 = ""

    @Column(comment = "文件大小", nullable = false, defaultValue = "0", sort = 80)
    var fileSize = 0L

    @Column(comment = "存储桶名称", length = 200, nullable = true, sort = 90)
    var bucketName = ""

    /**
     * 文件来源，可能为系统生成后传到存储桶，也可能为用户上传
     */
    @ColumnRelateDict(dictCode = "sysFileSourceType")
    @Column(comment = "文件来源", nullable = false, sort = 100)
    var sourceType = 0

    @Column(comment = "文件过期时间", sort = 110)
    var expireDate: Date? = null

    /**
     * 目前分为三级，低，中，高
     * 等级为低的文件，如果存储空间不足可能被清理
     * 等级为中，文件不会被清理
     * 等级为高，文件为永久保存
     */
    @ColumnRelateDict(dictCode = "sysFileGrade")
    @Column(comment = "文件等级", nullable = false, defaultValue = "10", sort = 120)
    var fileGrade = 0
}